/**
 * 
 */
package org.t2.backstage.module.giftcode.model;

import java.util.ArrayList;
import java.util.List;

import org.banish.sql.core.annotation.Column;
import org.banish.sql.core.annotation.Id;
import org.banish.sql.core.annotation.Table;
import org.banish.sql.core.annotation.Id.Strategy;
import org.banish.sql.core.entity.AbstractEntity;
import org.gaming.service.repository.annotation.NoCache;
import org.springframework.stereotype.Repository;

import sh.t2.share.module.mail.MailAttachment;

/**
 * @author YY
 *
 */
@Repository
@NoCache
@Table(comment = "礼包码表", dbAlias = "backdata")
public class GiftCode extends AbstractEntity {
	@Id(strategy = Strategy.AUTO)
	@Column(comment = "礼包ID")
	private long id;
	@Column(comment = "礼包码类型，1通码，2随机码", readonly = true)
	private int type;
	@Column(comment = "礼包码", readonly = true)
	private String code;
	@Column(comment = "礼包名称")
	private String name;
	@Column(comment = "过期时间", extra = "time")
	private long expireTime;
	@Column(comment = "奖励", length = 5000)
	private List<MailAttachment> rewards = new ArrayList<>();
	@Column(comment = "是否启用")
	private boolean usable;
	@Column(comment = "渠道ID")
	private long channelId;
	@Column(comment = "服务器唯一ID")
	private long serverUid;
	@Column(comment = "生成数量")
	private int num;
	
	@Column(comment = "创建的用户ID", readonly = true)
	private long userId;
	@Column(comment = "创建的用户名称", readonly = true)
	private String userName;
	@Column(comment = "启用的用户ID")
	private long useUserId;
	@Column(comment = "启用的用户名称")
	private String useUserName;
	
	
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public long getUserId() {
		return userId;
	}
	public void setUserId(long userId) {
		this.userId = userId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public long getExpireTime() {
		return expireTime;
	}
	public void setExpireTime(long expireTime) {
		this.expireTime = expireTime;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public List<MailAttachment> getRewards() {
		return rewards;
	}
	public void setRewards(List<MailAttachment> rewards) {
		this.rewards = rewards;
	}
	public boolean isUsable() {
		return usable;
	}
	public void setUsable(boolean usable) {
		this.usable = usable;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public long getChannelId() {
		return channelId;
	}
	public void setChannelId(long channelId) {
		this.channelId = channelId;
	}
	public long getServerUid() {
		return serverUid;
	}
	public void setServerUid(long serverUid) {
		this.serverUid = serverUid;
	}
	public long getUseUserId() {
		return useUserId;
	}
	public void setUseUserId(long useUserId) {
		this.useUserId = useUserId;
	}
	public String getUseUserName() {
		return useUserName;
	}
	public void setUseUserName(String useUserName) {
		this.useUserName = useUserName;
	}
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	@Override
	public long idGenerator() {
		return 1L;
	}
}
